import { ref, computed, reactive } from 'vue'
import { defineStore } from 'pinia'

export const useUserInfo = defineStore('user', () => {
  const permissions = ref({})
  const navList = ref([])
  const juedgePermissionInit = ref(false)
  const userInfo = ref({})
  const setPermissions = (payload: {}) => {
    permissions.value = payload
  }
  const setJuedgePermissionInit = (payload: boolean) => {
    juedgePermissionInit.value = payload
  }
  const setNavListList = (payload: []) => {
    navList.value = payload
  }
  const setUserInfo = (payload: object) => {
    localStorage.setItem('SpaceUser', JSON.stringify(payload))
    userInfo.value = payload
  }
  return {
    permissions,
    navList,
    juedgePermissionInit,
    userInfo,
    setPermissions,
    setNavListList,
    setJuedgePermissionInit,
    setUserInfo
  }
})
